function [V, NF] = loadV(filename, Xnames)

M = importdata(filename, ' ', 1);

vars  = M.textdata(2:end);
pesos = diag(M.data);

noms = Xnames;
noms = strrep(noms, ' ', '');
noms = strrep(noms, '	', '');

vars = strrep(vars, ' ', '');
vars = strrep(vars, '	', '');

n = length(vars);
nc = length(noms);
V = zeros(nc,1);

NotFound = [];
j = 0;
for i = 1:n
    ind = find(strcmp(noms, vars{i}));
    if ~isempty(ind);
        V(ind) = pesos(i);
    else
        j = j + 1;
        NotFound.X{j} = vars{i};
        NotFound.V{j} = pesos(i);
    end
end
if isempty(NotFound)
    fprintf(1, 'loadV: Matrix V successfully loaded from %s\n', filename);
else
    fprintf(1, 'loadV: Matrix V loaded from %s\nSome missing fields found:\n', filename);
    disp(NotFound)
end
if nargout > 1
    NF = NotFound;
end